import java.util.List;
import java.util.ArrayList;


public class ReduceList {

  public static void main(String[] args) {
    int[] array = { 1, 2, 2, 3, 3, 4, 5, 6, 6, 7, 8, 8, 9 };
    int[] result = reduce(array);

    for (int i = 0; i < result.length; i++) {
      System.out.print(result[i]);
      System.out.print(i == result.length - 1 ? "\n" : " ");
    }
  }

  private static int[] reduce(int[] array) {
    List<Integer> result = new ArrayList<>();
    for (int i = 0; i < array.length; i++) {
      if (!result.contains(array[i]))
        result.add(array[i]);
    }

    int[] list = new int[result.size()];
    for (int i = 0; i < result.size(); i++) {
      list[i] = result.get(i);
    }
    return list;
  }
}
